<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<style>
   .a {
       width: 500px;
       height: 500px;
       background: red;
   }
   .b {
       width: 400px;
       height: 200px;
       background: greenyellow;
   }
   
</style>
<body id="bo">
    <div class="a" id="div1">
        <div class="b" id="div2">
            <input type="text" id="inp">
        </div>
    </div>
</body>
    
    <script>
        var bo = document.getElementById("bo");
        var div1 = document.getElementById("div1");
        var div2 = document.getElementById("div2");
        var inp = document.getElementById("inp");

        bo.addEventListener("click", function (event) {
            var e = window.event || event;
            console.log(e.buttons);
            if (e && e.stopPropagation) {
                e.stopPropagation();
            }else {
                window.event.cancelBubble = true;
            }
            console.log("body");
        },false)
        div1.addEventListener("click", function (event) {
            console.log("div1");
            // var e = window.event || event;
            // console.log(e.buttons);
        },false)
        div2.addEventListener("click", function (event) {
            console.log("div2");
        },false)
        inp.addEventListener("click", function (event) {
            var e = window.event || event;
            console.log(e.buttons);
            if (e && e.stopPropagation) {
                e.stopPropagation();
            }else {
                window.event.cancelBubble = true;
            }
            console.log("inp");
        },false)

    </script>
</html>